package org.example.forum.dao;

import io.swagger.v3.oas.annotations.Parameter;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.example.forum.model.Message;

import java.util.List;

@Mapper
public interface MessageMapper {
    int insert(Message record);

    int insertSelective(Message record);

    Message selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(Message record);

    int updateByPrimaryKey(Message record);

    /**
     * 根据用户id查询站内信未读数量
     * @param receiveUserId 用户id
     * @return 未读数量
     */
    Integer selectUnreadCount(@Param("receiveUserId") Long receiveUserId);

    /**
     * 根据接收者id查询所有站内信
     * @param receiveUserId 根据接收者id
     * @return 站内信列表
     */
    List<Message> selectByReceiveUserId (@Param("receiveUserId") Long receiveUserId);
}